<?php
	$liga = new Liga($settings->activeLeague);
	$liga->getRounds();
	$i = 1; // broj kola
?>

            <div class="twoCollumns">
            	<div class="leftCollumn">

	<?php 
	if (count($liga->rounds)) {
		foreach ($liga->rounds as $round) { ?>
		
                	<div class="leftBox">
                    	<table class="tabela" cellpadding="0" cellspacing="0">
                        <tbody>
                        
                        <?php
							$round->getMecevi();
							foreach($round->mecevi as $mec) {
								if($mec->odigrana == 1) {
									$mec->domacin->getRoster();
									$mec->domacin->stats = $mec->domacin->getMatchStats($mec->id);
									
									$mec->gost->getRoster();
									$mec->gost->stats = $mec->gost->getMatchStats($mec->id);								
								}
						?>
                         	<tr>
                            	<td class="tabelaCrest"><img src="media/teams/logo/<?php echo $mec->domacin->grb; ?>" height="25" /></td>
                            	<td class="tabelaNameSchedule"><a href="team/<?php echo $mec->domacin->id; ?>/<?php echo str_replace(" ", "-", $mec->domacin->ime); ?>"><?php echo $mec->domacin->ime; ?></a></td>
                                	<?php if($mec->odigrana) {?>
                                    <td class="tabelaPointsSchedule">
                                	<a href="match/<?php echo $mec->id; ?>"><?php echo $mec->domacin->stats->pts; ?>-<?php echo $mec->gost->stats->pts; ?></a>
                                    </td>
                                    <?php } ?>
                                	<?php if(!$mec->odigrana) {?>
                                	<td class="tabelaTimeSchedule"><?php echo $mec->vreme; ?></td>
                                    <?php } ?>
                            	<td class="tabelaName2Schedule"><a href="team/<?php echo $mec->gost->id; ?>/<?php echo str_replace(" ", "-", $mec->gost->ime); ?>"><?php echo $mec->gost->ime; ?></a></td>
                            	<td class="tabelaCrest"><img src="media/teams/logo/<?php echo $mec->gost->grb; ?>" height="25" /></td>
                           </tr>
                        <?php
							}
						?>
                        </tbody>
                        </table>
                    </div>
                    <h3 class="smallBoxTitle"><a href="#"><?php echo $round->datum; ?></a></h3>
	<?php }
		  }
	?>
                                        
                </div>
                
                <div class="rightCollumn">
                                    
                	<div class="smallBox">
                    	<table class="tabela" cellpadding="0" cellspacing="0">
                        <thead>
                            <tr>
                            	<td>#</td>
                            	<td>Tim</td>
                            	<td></td>
                            	<td>Pt</td>
                            </tr>
                        </thead>
                        <tbody>
                    <?php
						$tabela = new Standings($settings->activeLeague, 1);
						$tabela->getTeams();
						$tabela->getTeamsStats();
						$tabela->sortTeams();
						
						$pozicija = 1;
						
						foreach($tabela->tabela as $tim2) {
						
					?>
                        	<tr>
                            	<td class="tabelaPosition"><?php echo $pozicija++; ?></td>
                            	<td class="tabelaCrest"><img src="media/teams/logo/<?php echo $tim2->grb; ?>" height="25" /></td>
                            	<td class="tabelaName"><a href="team/<?php echo $tim2->id; ?>/<?php echo str_replace(" ", "-", $tim2->ime); ?>"><?php echo $tim2->ime; ?></a></td>
                            	<td class="tabelaPoints"><?php echo $tim2->brojPoena; ?></td>
                            </tr>
                    <?php
						}
					?>
                        </tbody>
                        </table>
                    </div>
                    <h3 class="smallBoxTitle"><a href="#">Tabela</a></h3>
                    
                </div>
            </div><!-- end of middle_content -->

